import 'dart:ui';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:magic_car/common/shareWidget.dart';
import 'package:magic_car/jiance/b_order.dart';
import 'package:magic_car/user/chargerVip.dart';
import 'package:magic_car/util/HttpHelper.dart';
import 'package:magic_car/util/ToastUtil.dart';
import 'package:magic_car/util/colors.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:magic_car/main.dart';
import 'package:toast/toast.dart';
import 'package:dio/dio.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:io';
import 'dart:async';
import 'package:fluwx/fluwx.dart';

//车商个人中心
class CSUserPage extends StatefulWidget {
  CSUserPage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<CSUserPage> {
  Map userinfo = new Map();
  File _image;
  String avatar = "";
  String agent = "0";
  String balance = "0.00";
  String free_des = "";

  @override
  void initState() {
    super.initState();
    loaduserinfo();
  }

  //

  loaduserinfo() async {
    SharedPreferences pref = await SharedPreferences.getInstance();
    Map<String, String> map = new Map();
    map["id"] = pref.getString('uid');
    setState(() {
      agent = pref.getString('agent').toString();
    });

    HttpHelper.post(HttpHelper.API_BusinessInfo, (data) async {
      if (data != null) {
        print(data);
        //Toast.show(data["msg"], context);

        if (data["code"].toString() == "1") {
          if (data["info"]["avatar"].length != 0) {
            setState(() {
              avatar = data["info"]["avatar"];
            });
          }

          setState(() {
            userinfo = data["info"];
            balance = data["info"]["balance"].toString();
            free_des = data["info"]['free_des'];
          });
          //pref.setStringList('userinfo', data["info"]);

        }
      }
    }, params: map);
  }

  //更新头像信息
  uploadAvatar() async {
    SharedPreferences pref = await SharedPreferences.getInstance();
    Map<String, String> map = new Map();
    map["id"] = pref.getString('uid');
    map["avatar"] = avatar;

    HttpHelper.post(HttpHelper.API_UpdateAvatar, (data) async {
      if (data != null) {
        print(data);
        Toast.show(data["msg"], context);
      }
    }, params: map);
  }

  //选择图片
  getimgs(type) async {
    if (type == 1) {
      var image = await ImagePicker.pickImage(source: ImageSource.gallery);

      setState(() {
        _image = image;
      });
    } else {
      var image = await ImagePicker.pickImage(source: ImageSource.camera);

      setState(() {
        _image = image;
      });
    }

    if (_image == null) return;
    Map<String, String> map = new Map();
    HttpHelper.upLoadImage(_image, (data) {
      if (data.containsKey('code')) {
        Toast.show(data['msg'], context);
      } else {
        setState(() {
          avatar = data['url'];
        });
        uploadAvatar();
      }
    }, params: map);
  }

//选择图片方式
  Future getImage() async {
    showDialog(
        context: context,
        builder: (BuildContext context) {
          return new SimpleDialog(
            title: new Text('选择'),
            children: <Widget>[
              new SimpleDialogOption(
                child: new Text('相机'),
                onPressed: () {
                  Navigator.pop(context);
                  getimgs(0);
                },
              ),
              new SimpleDialogOption(
                child: new Text('相册'),
                onPressed: () {
                  Navigator.pop(context);
                  getimgs(1);
                },
              )
            ],
          );
        });
    // var image = await ImagePicker.pickImage(source: ImageSource.gallery);
    // //_upLoadImage(image);//上传图片
    // setState(() {
    //   _image = image;
    // });
  }
  // uploadimg() async{
  //   Map<String, String> map = new Map();
  // // Navigator.of(context).pop();
  // HttpHelper.upLoadImage(_files, (data)  {
  //   // Navigator.of(context).pop();

  //   var carnum = "";
  //   var imagepath = "";
  //   _alert(data["errorMessage"]);
  //   if (data["code"] == 1) {
  //   } else {
  //     carnum = data["data"]["car_number"];
  //     imagepath = data["data"]["image_url"];
  //   }

  //   // loadingPage.close();
  //   for(var addressitem in _address){
  //     if(addressitem["road"]["name"]==currentAdd){
  //       address_Id = addressitem["road"]["id"];
  //     }
  //   }
  //   Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
  //     return new CarNumPage(carnum, imagepath,address_Id,currentAdd);
  //   }));
  //   // _alert(data["errorMessage"]);
  // }, params: map);
  // }

  Widget build(BuildContext context) {
    return
        // new MaterialApp(
        //     title: '个人中心',
        //     home:
        new Scaffold(
            appBar: new AppBar(
                title:
                Center(child:
                 new Text(
                  '个人中心',
                  style: TextStyle(color: Colors.white),
                )),
                backgroundColor: Colours.app_main,
                elevation: 0),
            body:
                //     SingleChildScrollView(
                //       scrollDirection: Axis.vertical,
                // //true 滑动到底部
                // reverse: false,
                // padding: EdgeInsets.all(0.0),
                // physics: BouncingScrollPhysics(),
                // child:
                new ListView(children: <Widget>[
              Container(
                  height: 260,
                  child: Stack(children: <Widget>[
                    Positioned(
                      top: 0,
                      left: 0,
                      right: 0,
                      // child:
                      // Center(
                      child: new Container(
                          color: Colours.app_main,
                          height: 150,
                          // width: double.infinity,
                          child: Text('')),
                    ),
                    Positioned(
                      top: 80.0,
                      left: 20,
                      right: 20,
                      child: new Container(
                        height: agent == "1" ? 170 : 200,
                        decoration: new BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.all(Radius.circular(5)),
                            border:
                                new Border.all(width: 0, color: Colors.white)),
                        child: Column(
                          children: <Widget>[
                            Padding(
                              padding: new EdgeInsets.fromLTRB(0, 60, 0, 0),
                              child: Text(
                                userinfo.length != 0 ? userinfo["name"] : "用户名",
                                style: TextStyle(fontSize: 18),
                              ),
                            ),
                            userinfo.length != 0
                                ? Padding(
                                    padding:
                                        new EdgeInsets.fromLTRB(0, 10, 0, 0),
                                    child: Row(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.center,
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: <Widget>[
                                        Align(
                                          child: Text(
                                              '已检测车源 ' +
                                                  userinfo['inspect_num'],
                                              style: new TextStyle(
                                                fontSize: 12,
                                                color: Colours.app_main,
                                              )),
                                          alignment: Alignment.centerRight,
                                        ),
                                        Padding(
                                          padding: new EdgeInsets.fromLTRB(
                                              10, 0, 0, 0),
                                          child: Text(
                                              '上架车源 ' + userinfo['online_num'],
                                              style: new TextStyle(
                                                fontSize: 12,
                                                color: Colours.app_main,
                                              )),
                                        ),
                                        Padding(
                                          padding: new EdgeInsets.fromLTRB(
                                              10, 0, 0, 0),
                                          child: Text(
                                              '保修量 ' + userinfo['guratee_num'],
                                              style: new TextStyle(
                                                fontSize: 12,
                                                color: Colours.app_main,
                                              )),
                                        ),
                                        // Expanded(
                                        //   flex: 1,
                                        //   child:
                                        // Align(
                                        //   child: Text('898'),
                                        //   alignment: Alignment.centerRight,
                                        // ),
                                        // //),
                                        // // Expanded(
                                        // //   flex: 1,
                                        // //   child:
                                        // Padding(
                                        //     padding:
                                        //         new EdgeInsets.fromLTRB(5, 0, 0, 0),
                                        //     child: Container(
                                        //       color: Colors.red,
                                        //       width: 30,
                                        //       child: Text(
                                        //         ' 极好',
                                        //         style: TextStyle(
                                        //             color: Colors.white,
                                        //             fontSize: 11),
                                        //       ),
                                        //     ))
                                        //)
                                      ],
                                    ))
                                : new Text(''),
                            agent == "1"
                                ? Container(height: 0)
                                :Container(
                                  margin: EdgeInsets.only(top:10),
                                  child: Row(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                    children: [
                                      // GestureDetector(
                                      //   behavior: HitTestBehavior.opaque,
                                      //   onTap: () {
                                      //     Navigator.pushNamed(
                                      //         context, "blance");
                                      //   },
                                      //   child: Text(
                                      //     '余额：¥ ' + balance,
                                      //     style: TextStyle(
                                      //         fontSize: 14, color: Colors.red),
                                      //   ),
                                      // ),
                                      // Container(width:20),
                                      GestureDetector(
                                        behavior: HitTestBehavior.opaque,
                                        onTap: () {
                                          Navigator.pushNamed(
                                              context, "chargergroup");
                                        },
                                        child: Text(
                                          userinfo["is_chargergroup"].toString()=="1"?"认证套餐：¥${userinfo['groupdata']['money']}":"认证套餐：充值" ,
                                          style: TextStyle(
                                              fontSize: 14, color:Colours.app_main),
                                        ),
                                      )
                                    ],
                                  )),
                            // : Padding(
                            //     padding:
                            //         new EdgeInsets.fromLTRB(0, 10, 0, 0),
                            //     child: GestureDetector(
                            //       behavior: HitTestBehavior.opaque,
                            //       onTap: () {
                            //         Navigator.pushNamed(context, "blance");
                            //       },
                            //       child: Text(
                            //         '余额：¥ ' + balance,
                            //         style: TextStyle(
                            //             fontSize: 14, color: Colors.red),
                            //       ),
                            //     )),
                                // Padding( padding:
                                //     new EdgeInsets.fromLTRB(0, 10, 0, 0),
                                // child: GestureDetector(
                                //   behavior: HitTestBehavior.opaque,
                                //   onTap: () {
                                //     Navigator.pushNamed(context, "blance");
                                //   },
                                //   child: Text(
                                //     '余额：¥ ' + balance,
                                //     style: TextStyle(
                                //         fontSize: 14, color: Colors.red),
                                //   ),
                                // )),

                            // agent == "1"
                            //     ? Container(height: 0)
                            //     : Padding(
                            //         padding:
                            //             new EdgeInsets.fromLTRB(0, 10, 0, 0),
                            //         child: GestureDetector(
                            //           behavior: HitTestBehavior.opaque,
                            //           onTap: () {
                            //             Navigator.of(context).push(
                            //                 new MaterialPageRoute(builder: (_) {
                            //               return new BevipPage();
                            //             })).then((param) {
                            //               loaduserinfo();
                            //             });
                            //             //Navigator.pushNamed(context, "blance");
                            //           },
                            //           child: Text(
                            //             free_des,
                            //             style: TextStyle(
                            //                 fontSize: 13, color: Colors.blue),
                            //           ),
                            //         )),
                          ],
                        ),
                      ),
                    ),
                    Positioned(
                        top: 30.0,
                        left: MediaQuery.of(context).size.width / 2 - 50,
                        child: Center(
                            child: new GestureDetector(
                          onTap: () {
                            //选择图片
                            // getImage();
                            Navigator.pushNamed(context, 'bedituser');
                          },
                          child: Container(
                              width: 100,
                              height: 100,
                              decoration: new BoxDecoration(
                                //背景
                                color: Colors.white,
                                //设置四周圆角 角度 这里的角度应该为 父Container height 的一半
                                borderRadius:
                                    BorderRadius.all(Radius.circular(50)),
                                //设置四周边框
                                border: new Border.all(
                                    width: 0.5, color: Colors.white),
                              ),
                              child: ClipRRect(
                                borderRadius: BorderRadius.circular(50),
                                child:avatar==""?Image.asset("resource/images/user/user1.png"):
                                CachedNetworkImage(imageUrl: avatar,fit: BoxFit.cover,)
                                // child: FadeInImage.assetNetwork(
                                //   placeholder: "resource/images/user/user1.png",
                                //   image: avatar,
                                //   fit: BoxFit.cover,
                                // ),
                                // child: avatar == ""
                                //     ? new Image.asset(
                                //         'resource/images/user/user1.png')
                                //     : new Image.network(avatar,height: 100,width: 100,fit: BoxFit.cover),
                              )),
                        ))),
                    // Positioned(
                    //     top: 110.0,
                    //     left: MediaQuery.of(context).size.width / 2 - 50 + 27,
                    //     child: new Text(agent == "1" ? '认证经纪人' : '认证商家',
                    //         style: TextStyle(
                    //           color: Colors.red,
                    //           fontSize: 11,
                    //           fontWeight: FontWeight.w600,
                    //         )))
                  ])),
              Padding(
                  padding: new EdgeInsets.fromLTRB(0, 10, 0, 0),
                  child: Container(
                    height: agent == "1" ? 357 : 458,
                    child: Stack(
                      children: <Widget>[
                        Positioned(
                          top: 0.0,
                          left: 20,
                          right: 20,
                          child: new Container(
                            height: agent == "1" ?  357 : 458,
                            decoration: new BoxDecoration(
                                color: Colors.white,
                                borderRadius:
                                    BorderRadius.all(Radius.circular(5)),
                                border: new Border.all(
                                    width: 0, color: Colors.white)),
                            child: Column(
                              children: <Widget>[
                                
                                Padding(
                                    padding:
                                        new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                    child: GestureDetector(
                                      behavior: HitTestBehavior.opaque,
                                      onTap: () {
                                        //查询车辆历史信息
                                      
                                        Navigator.pushNamed(context, "querycarinfopage");
                                      },
                                      child: Row(
                                        // crossAxisAlignment: CrossAxisAlignment.start,
                                        // mainAxisAlignment: MainAxisAlignment.start,
                                        children: <Widget>[
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment: Alignment.centerLeft,
                                                child: Image.asset(
                                                  'resource/images/user/querycarinfo.png',
                                                  height: 50,
                                                ),
                                              )),
                                          Expanded(
                                              flex: 7,
                                              child: Align(
                                                  alignment:
                                                      Alignment.centerLeft,
                                                  child: Text(
                                                    '查询车况                                       ',
                                                    style: TextStyle(
                                                        fontSize: 16,
                                                        color: Color.fromRGBO(
                                                            123, 123, 123, 1)),
                                                  ))),
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment:
                                                    Alignment.centerRight,
                                                child: Image.asset(
                                                  'resource/images/user/detail.png',
                                                  height: 20,
                                                ),
                                              ))
                                        ],
                                      ),
                                    )),
                                     Container(
                                  height: 1,
                                  color: Color.fromRGBO(245, 245, 245, 1),
                                ),
                               agent == "1" ?Container(height:0):
                               Padding(
                                    padding:
                                        new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                    child: GestureDetector(
                                      behavior: HitTestBehavior.opaque,
                                      onTap: () {
                                        Navigator.pushNamed(context, "authinsprctororder");
                                      },
                                      child: Row(
                                        // crossAxisAlignment: CrossAxisAlignment.start,
                                        // mainAxisAlignment: MainAxisAlignment.start,
                                        children: <Widget>[
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment: Alignment.centerLeft,
                                                child: Image.asset(
                                                  'resource/images/user/jilu.png',
                                                  height: 50,
                                                ),
                                              )),
                                          Expanded(
                                              flex: 7,
                                              child: Align(
                                                  alignment:
                                                      Alignment.centerLeft,
                                                  child: Text(
                                                    '认证检测                               ',
                                                    style: TextStyle(
                                                        fontSize: 16,
                                                        color: Color.fromRGBO(
                                                            123, 123, 123, 1)),
                                                  ))),
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment:
                                                    Alignment.centerRight,
                                                child: Image.asset(
                                                  'resource/images/user/detail.png',
                                                  height: 20,
                                                ),
                                              ))
                                        ],
                                      ),
                                    )),
                                     Container(
                                  height: agent == "1" ? 0 : 1,
                                  color: Color.fromRGBO(245, 245, 245, 1),
                                ),
                                Padding(
                                    padding:
                                        new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                    child: GestureDetector(
                                      onTap: () {
                                        //保修记录
                                        Navigator.pushNamed(
                                            context, "b_Gurateeorder");
                                      },
                                      child: Row(
                                        // crossAxisAlignment: CrossAxisAlignment.start,
                                        // mainAxisAlignment: MainAxisAlignment.start,
                                        children: <Widget>[
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment: Alignment.centerLeft,
                                                child: Image.asset(
                                                  'resource/images/user/jilu.png',
                                                  height: 50,
                                                ),
                                              )),
                                          Expanded(
                                              flex: 7,
                                              child: Align(
                                                  alignment:
                                                      Alignment.centerLeft,
                                                  child: Text(
                                                    '保修检测                                       ',
                                                    style: TextStyle(
                                                        fontSize: 16,
                                                        color: Color.fromRGBO(
                                                            123, 123, 123, 1)),
                                                  ))),
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment:
                                                    Alignment.centerRight,
                                                child: Image.asset(
                                                  'resource/images/user/detail.png',
                                                  height: 20,
                                                ),
                                              ))
                                        ],
                                      ),
                                    )),
                                     Container(
                                  height: 1,
                                  color: Color.fromRGBO(245, 245, 245, 1),
                                ),
                                agent == "0"
                                    ? Padding(
                                        padding: new EdgeInsets.fromLTRB(
                                            15, 0, 15, 0),
                                        child: GestureDetector(
                                          behavior: HitTestBehavior.opaque,
                                          onTap: () {
                                            //检测记录
                                            Navigator.of(context).push(
                                                new MaterialPageRoute(
                                                    builder: (_) {
                                              return new BOrderRecPage();
                                            })).then((param) {
                                              loaduserinfo();
                                            });

                                            // Navigator.pushNamed(
                                            //     context, "b_order");
                                          },
                                          child: Row(
                                            // crossAxisAlignment: CrossAxisAlignment.start,
                                            // mainAxisAlignment: MainAxisAlignment.start,
                                            children: <Widget>[
                                              Expanded(
                                                  flex: 1,
                                                  child: Align(
                                                    alignment:
                                                        Alignment.centerLeft,
                                                    child: Image.asset(
                                                      'resource/images/user/orderrec.png',
                                                      height: 50,
                                                    ),
                                                  )),
                                              Expanded(
                                                  flex: 7,
                                                  child: Align(
                                                      alignment:
                                                          Alignment.centerLeft,
                                                      child: Text(
                                                        '自检订单                               ',
                                                        style: TextStyle(
                                                            fontSize: 16,
                                                            color:
                                                                Color.fromRGBO(
                                                                    123,
                                                                    123,
                                                                    123,
                                                                    1)),
                                                      ))),
                                              Expanded(
                                                  flex: 1,
                                                  child: Align(
                                                    alignment:
                                                        Alignment.centerRight,
                                                    child: Image.asset(
                                                      'resource/images/user/detail.png',
                                                      height: 20,
                                                    ),
                                                  ))
                                            ],
                                          ),
                                        ))
                                    : new Container(height: 0),
                                Container(
                                  height: 1,
                                  color: Color.fromRGBO(245, 245, 245, 1),
                                ),
                                Padding(
                                    padding:
                                        new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                    child: GestureDetector(
                                      behavior: HitTestBehavior.opaque,
                                      onTap: () {
                                        Navigator.pushNamed(context, "mycar");
                                      },
                                      child: Row(
                                        // crossAxisAlignment: CrossAxisAlignment.start,
                                        // mainAxisAlignment: MainAxisAlignment.start,
                                        children: <Widget>[
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment: Alignment.centerLeft,
                                                child: Image.asset(
                                                  'resource/images/user/mycars.png',
                                                  height: 50,
                                                ),
                                              )),
                                          Expanded(
                                              flex: 7,
                                              child: Align(
                                                  alignment:
                                                      Alignment.centerLeft,
                                                  child: Text(
                                                    '我的车源                               ',
                                                    style: TextStyle(
                                                        fontSize: 16,
                                                        color: Color.fromRGBO(
                                                            123, 123, 123, 1)),
                                                  ))),
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment:
                                                    Alignment.centerRight,
                                                child: Image.asset(
                                                  'resource/images/user/detail.png',
                                                  height: 20,
                                                ),
                                              ))
                                        ],
                                      ),
                                    )),
                               
                               
                                Container(
                                  height: 1,
                                  color: Color.fromRGBO(245, 245, 245, 1),
                                ),
                                Padding(
                                    padding:
                                        new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                    child: GestureDetector(
                                      behavior: HitTestBehavior.opaque,
                                      onTap: () {
                                        //联系我们
                                        Navigator.pushNamed(context, "contact");
                                      },
                                      child: Row(
                                        // crossAxisAlignment: CrossAxisAlignment.start,
                                        // mainAxisAlignment: MainAxisAlignment.start,
                                        children: <Widget>[
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment: Alignment.centerLeft,
                                                child: Image.asset(
                                                  'resource/images/user/contact.png',
                                                  height: 50,
                                                ),
                                              )),
                                          Expanded(
                                              flex: 7,
                                              child: Align(
                                                  alignment:
                                                      Alignment.centerLeft,
                                                  child: Text(
                                                    '联系我们                                      ',
                                                    style: TextStyle(
                                                        fontSize: 16,
                                                        color: Color.fromRGBO(
                                                            123, 123, 123, 1)),
                                                  ))),
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment:
                                                    Alignment.centerRight,
                                                child: Image.asset(
                                                  'resource/images/user/detail.png',
                                                  height: 20,
                                                ),
                                              ))
                                        ],
                                      ),
                                    )),
                                Container(
                                  height: 1,
                                  color: Color.fromRGBO(245, 245, 245, 1),
                                ),
                                Padding(
                                    padding:
                                        new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                    child: GestureDetector(
                                      onTap: () {
                                        //设置
                                        Navigator.pushNamed(context, "bacount");
                                      },
                                      child: Row(
                                        // crossAxisAlignment: CrossAxisAlignment.start,
                                        // mainAxisAlignment: MainAxisAlignment.start,
                                        children: <Widget>[
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment: Alignment.centerLeft,
                                                child: Image.asset(
                                                  'resource/images/user/wallets.png',
                                                  height: 50,
                                                ),
                                              )),
                                          Expanded(
                                              flex: 7,
                                              child: Align(
                                                  alignment:
                                                      Alignment.centerLeft,
                                                  child: Text(
                                                    '我的钱包                                       ',
                                                    style: TextStyle(
                                                        fontSize: 16,
                                                        color: Color.fromRGBO(
                                                            123, 123, 123, 1)),
                                                  ))),
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment:
                                                    Alignment.centerRight,
                                                child: Image.asset(
                                                  'resource/images/user/detail.png',
                                                  height: 20,
                                                ),
                                              ))
                                        ],
                                      ),
                                    )),
                                // Container(
                                //   height: 1,
                                //   color: Color.fromRGBO(245, 245, 245, 1),
                                // ),
                                // Padding(
                                //     padding:
                                //         new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                //     child: GestureDetector(
                                //       onTap: () {
                                //         //考试记录testrec
                                //         Navigator.pushNamed(context, "testrec");
                                //       },
                                //       child: Row(
                                //         // crossAxisAlignment: CrossAxisAlignment.start,
                                //         // mainAxisAlignment: MainAxisAlignment.start,
                                //         children: <Widget>[
                                //           Expanded(
                                //               flex: 1,
                                //               child: Align(
                                //                 alignment: Alignment.centerLeft,
                                //                 child: Image.asset(
                                //                   'resource/images/user/jilu.png',
                                //                   height: 50,
                                //                 ),
                                //               )),
                                //           Expanded(
                                //               flex: 7,
                                //               child: Align(
                                //                   alignment:
                                //                       Alignment.centerLeft,
                                //                   child: Text(
                                //                     '我的钱包                                       ',
                                //                     style: TextStyle(
                                //                         fontSize: 16,
                                //                         color: Color.fromRGBO(
                                //                             123, 123, 123, 1)),
                                //                   ))),
                                //           Expanded(
                                //               flex: 1,
                                //               child: Align(
                                //                 alignment:
                                //                     Alignment.centerRight,
                                //                 child: Image.asset(
                                //                   'resource/images/user/detail.png',
                                //                   height: 20,
                                //                 ),
                                //               ))
                                //         ],
                                //       ),
                                //     )),
                                // Container(
                                //   height: 1,
                                //   color: Color.fromRGBO(245, 245, 245, 1),
                                // ),
                                // Padding(
                                //     padding:
                                //         new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                //     child: GestureDetector(
                                //       onTap: () {
                                //         //设置
                                //         Navigator.pushNamed(context, "set");
                                //       },
                                //       child: Row(
                                //         // crossAxisAlignment: CrossAxisAlignment.start,
                                //         // mainAxisAlignment: MainAxisAlignment.start,
                                //         children: <Widget>[
                                //           Expanded(
                                //               flex: 1,
                                //               child: Align(
                                //                 alignment: Alignment.centerLeft,
                                //                 child: Image.asset(
                                //                   'resource/images/user/lianxi.png',
                                //                   height: 50,
                                //                 ),
                                //               )),
                                //           Expanded(
                                //               flex: 7,
                                //               child: Align(
                                //                   alignment:
                                //                       Alignment.centerLeft,
                                //                   child: Text(
                                //                     '我的钱包                                       ',
                                //                     style: TextStyle(
                                //                         fontSize: 16,
                                //                         color: Color.fromRGBO(
                                //                             123, 123, 123, 1)),
                                //                   ))),
                                //           Expanded(
                                //               flex: 1,
                                //               child: Align(
                                //                 alignment:
                                //                     Alignment.centerRight,
                                //                 child: Image.asset(
                                //                   'resource/images/user/detail.png',
                                //                   height: 20,
                                //                 ),
                                //               ))
                                //         ],
                                //       ),
                                //     )),
                                Container(
                                  height: 1,
                                  color: Color.fromRGBO(245, 245, 245, 1),
                                ),
                                Padding(
                                    padding:
                                        new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                    child: GestureDetector(
                                      onTap: () {
                                        // showModalBottomSheet(
                                        //     context: context,
                                        //     builder: (BuildContext context) {
                                        //       return ShareWidget();
                                        //     });
                                        //设置
                                        Navigator.pushNamed(context, "code");
                                      },
                                      child: Row(
                                        // crossAxisAlignment: CrossAxisAlignment.start,
                                        // mainAxisAlignment: MainAxisAlignment.start,
                                        children: <Widget>[
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment: Alignment.centerLeft,
                                                child: Image.asset(
                                                  'resource/images/user/code.png',
                                                  height: 50,
                                                ),
                                              )),
                                          Expanded(
                                              flex: 7,
                                              child: Align(
                                                  alignment:
                                                      Alignment.centerLeft,
                                                  child: Text(
                                                    '我的二维码                                       ',
                                                    style: TextStyle(
                                                        fontSize: 16,
                                                        color: Color.fromRGBO(
                                                            123, 123, 123, 1)),
                                                  ))),
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment:
                                                    Alignment.centerRight,
                                                child: Image.asset(
                                                  'resource/images/user/detail.png',
                                                  height: 20,
                                                ),
                                              ))
                                        ],
                                      ),
                                    )),
                                Container(
                                  height: 1,
                                  color: Color.fromRGBO(245, 245, 245, 1),
                                ),
                                Padding(
                                    padding:
                                        new EdgeInsets.fromLTRB(15, 0, 15, 0),
                                    child: GestureDetector(
                                      behavior: HitTestBehavior.opaque,
                                      onTap: () {
                                        //设置
                                        Navigator.pushNamed(context, "set");
                                      },
                                      child: Row(
                                        // crossAxisAlignment: CrossAxisAlignment.start,
                                        // mainAxisAlignment: MainAxisAlignment.start,
                                        children: <Widget>[
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment: Alignment.centerLeft,
                                                child: Image.asset(
                                                  'resource/images/user/set.png',
                                                  height: 50,
                                                ),
                                              )),
                                          Expanded(
                                              flex: 7,
                                              child: Align(
                                                  alignment:
                                                      Alignment.centerLeft,
                                                  child: Text(
                                                    '关于我们                                       ',
                                                    style: TextStyle(
                                                        fontSize: 16,
                                                        color: Color.fromRGBO(
                                                            123, 123, 123, 1)),
                                                  ))),
                                          Expanded(
                                              flex: 1,
                                              child: Align(
                                                alignment:
                                                    Alignment.centerRight,
                                                child: Image.asset(
                                                  'resource/images/user/detail.png',
                                                  height: 20,
                                                ),
                                              ))
                                        ],
                                      ),
                                    )),
                              ],
                            ),
                          ),
                        ),
                      ],
                    ),
                  )),
              Padding(
                  padding: new EdgeInsets.fromLTRB(0, 10, 0, 0),
                  child: Container(
                    padding: new EdgeInsets.fromLTRB(20, 0, 20, 0),
                    height: 50,
                    decoration: new BoxDecoration(
                        // color: Colors.white,
                        borderRadius: BorderRadius.all(Radius.circular(5)),
                        border: new Border.all(width: 0, color: Colors.white)),
                    child: SizedBox(
                        width: double.infinity,
                        height: 50,
                        child: new FlatButton(
                          child: Text(
                            '退出登录',
                            style: TextStyle(
                                color: Color.fromRGBO(102, 102, 102, 1),
                                fontSize: 16),
                          ),
                          color: Colors.white,
                          textColor: Colors.black,
                          onPressed: () async {
                            SharedPreferences pref =
                                await SharedPreferences.getInstance();
                            pref.clear();
                            Navigator.of(context).pushAndRemoveUntil(
                                new MaterialPageRoute(
                                    builder: (context) => new MyApp()),
                                (route) => route == null);
                          },
                        )),
                  ))
            ]));
  }
}
